<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>订单详情</title>
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="__PUBLIC__/Css/my.css" rel="stylesheet">

    <script src="__PUBLIC__/Js/my.js"></script>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
</head>
<body style="margin-bottom:20px;">
<div class="container">
    <include file="Public:top" title="订单详情" />

    <include file="Public:orderDetail" status="未支付"/>

    <div class="row" style="margin-top: 20px;margin-bottom: 20px;" id="pay-nav">
        <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8 col-xs-offset-2 col-sm-offset-2 col-md-offset-2 col-lg-offset-2 pay-bn" align="center" onclick="pay()" style="background-color: #4aaf33;">
            微信支付
        </div>
    </div>

    <div class="row" id="payed-nav" style="display: none;margin-top: 20px;">
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 col-xs-offset-1 col-sm-offset-1 col-md-offset-1 col-lg-offset-1 pay-bn" id="back-home" align="center" onclick="jumpTo('/?m=Home&c=Index&a=index')" style="background-color: #c8c8c8;">
            返回主页
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 col-xs-offset-2 col-sm-offset-2 col-md-offset-2 col-lg-offset-2 pay-bn" id="to-order" align="center" onclick="jumpTo('/?m=Home&c=Order&a=index')" style="background-color: #ff9900;">
            我的订单
        </div>
    </div>
</div>

<script type="text/javascript">

    function onBridgeReady() {
        WeixinJSBridge.invoke(
                'getBrandWCPayRequest', {$jsApiParameters},
                function (res) {
                    if (res.err_msg == "get_brand_wcpay_request:ok") {
                        //alert("支付成功!");
                        //todo 支付成功跳转到该订单详情页面
                        $("#order-status").html("已支付");
                        $("#pay-nav").css("display","none");
                        $("#payed-nav").css("display","");
                    }
                }
        );
    }
    /**
     * 支付方法
     */
    function pay() {
        if (typeof WeixinJSBridge == "undefined") {
            alert("请使用微信浏览器支付");
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        } else {
            onBridgeReady();
        }
    }
    function delayURL(url,time){
        setTimeout("top.location.href = '" + url + "'",time);
    }
</script>
</body>
</html>